<script type="text/javascript">
    $('thead input[type="checkbox"]').click(function (){
        $('tbody input[type="checkbox"]').prop("checked", this.checked);
    });
</script>